#include <bits/stdc++.h>
using namespace std;
const int N = 4e4 + 10;
int a[N], b[N];
long long cnta[N], cntb[N];
int n, m;
long long k;
void cnt(int arr[], int len, long long cnt[]) {
  int i = 1;
  while (i <= len) {
    if (a[i] == 0) {
      i++;
      continue;
    }
    int j = i;
    while (j <= len && arr[j]) {
      j++;
    }
    int s = j - i;
    for (int k = 1; k <= s; ++k) {
      cnt[k] += s - k + 1;
    }
    i = j;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> b[i];

  cnt(a, n, cnta);
  cnt(b, m, cntb);
  long long res = 0;

  for (int i = 1; i <= n; ++i) {
    if (k % i == 0 && k / i <= m) {
      res += cnta[i] * cntb[k / i];
    }
  }
  cout << res << endl;
}
